/*
 * =====================================================================================
 *
 *       Filename:  mytest.cpp
 *
 *    Description:  g_test
 *
 *        Version:  1.0
 *        Created:  2008年09月24日 15时47分52秒
 *       Revision:  none
 *       Compiler:  g++
 *
 *         Author:  ZhixiongHong (hzx), fishwarter@gmail.com
 *        Company:  Unioncast
 *
 * =====================================================================================
 */

#include <iostream>
#include <gtest/gtest.h>

using namespace std;
using namespace testing;


int factorial(int n)
{
	if( n==0 )
		return n;
	int ret = 1;
	for(int i = 2; i <=n; i++)
		ret *= i;
	
	return ret;
}


TEST(factorial_test, HandlesZeroInput)
{
	EXPECT_EQ(0,factorial(0)) << "nnd " << endl;
}	

TEST(factorial_test, HandlesPositiveInput)
{
	EXPECT_EQ(1, factorial(1));
	EXPECT_EQ(2, factorial(2));
	EXPECT_EQ(6, factorial(3));
	ASSERT_EQ(4, factorial(4));
	
}	

int main(int argc, char** argv)
{
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}



